import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)
// 解决重复点击的问题
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}
const routes = [


    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/Login',
        name: 'Login',
        component: Login
    },
    {
        path: '/home',
        name: 'home',
        component: () => import('../views/Home.vue'),
        redirect: '/homeview/index',
        children: [{
            path: '/home/index/餐桌管理xx',
            name: '餐桌管理xx',
            component: () => import('../views/餐桌管理xx.vue'),
        },
        {
            path: '/home/index/菜品管理xx',
            name: '菜品管理xx',
            component: () => import('../views/菜品管理xx.vue'),
        },

        {
            // 拦截直接进入注册页面
            path: '/',
            redirect: '/login'
            // 跳转到登陆页
        },
        {
            path: '/Login',
            name: 'Login',
            component: Login
        },
        {
            path: '/home',
            name: 'home',
            component: () => import('../views/Home.vue'),
            redirect: '/homeview/index',
            children: [{
                path: '/home/index/餐桌管理xx',
                name: '餐桌管理xx',
                component: () => import('../views/餐桌管理xx.vue'),
            },
            {
                path: '/home/index/菜品管理xx',
                name: '菜品管理xx',
                component: () => import('../views/菜品管理xx.vue'),
            },
            {
                path: '/home/index/点菜管理xx',
                name: '点菜管理xx',
                component: () => import('../views/点菜管理xx.vue'),
            },
            // -----------------------------------------------------------------
            {
                path: '/home/index/会员管理xx',
                name: '会员管理',
                component: () => import('../views/Homeview.vue'),
            },
            {
                path: '/home/index/人员管理xx',
                name: 'homeview',
                component: () => import('../views/Homeview.vue'),
            },
            // -----------------------------------------------------------------
            {
                path: '/home/index/收银xx',
                name: '收银',
                component: () => import('../views/收银xx.vue'),
            },
            ]

        },
        ]
    ]